package com.tdkj.service.shop.impl;

import java.math.BigDecimal;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.tdkj.dao.shop.IBeanShelfCustomDao;
import com.tdkj.model.shop.BeanShelfCustom;
import com.tdkj.service.BaseService;
import com.tdkj.service.shop.IBeanShelfCustomService;
@Component("shopShelfCustomService")
public class BeanShelfCustomServiceImpl extends BaseService implements
		IBeanShelfCustomService {

	private IBeanShelfCustomDao beanShelfCustomDao;
    
	@Resource
	public void setBeanShelfCustomDao(IBeanShelfCustomDao beanShelfCustomDao) {
		this.beanShelfCustomDao = beanShelfCustomDao;
	}

	public IBeanShelfCustomDao getBeanShelfCustomDao() {
		return beanShelfCustomDao;
	}

	@Override
	public BeanShelfCustom add(Integer quantity, String unit, BigDecimal price) {
		BeanShelfCustom bean = new BeanShelfCustom();
		bean.setQuantity(quantity);
		bean.setUnit(unit);
		bean.setPrice(price);
		beanShelfCustomDao.save(bean);
		
		return bean;
	}

	@Override
	public void update(Long id, Integer quantity, String unit, BigDecimal price) {
		BeanShelfCustom bean = beanShelfCustomDao.findById(id, BeanShelfCustom.class);
		bean.setQuantity(quantity);
		bean.setUnit(unit);
		bean.setPrice(price);
	}

}
